/**
 * Copyright (C) 2012 The SkyTvOS Project
 * <p/>
 * Version     Date           Author
 * ─────────────────────────────────────
 * 2015年1月14日         Root.Lu
 */

package com.coocaa.launcher.statusplugins.tips;

import com.coocaa.launcher.framework.launcherhost.statusbar.StatusBarPlugin;
import com.coocaa.launcher.framework.launcherhost.statusbar.StatusBarPluginView;
import com.coocaa.x.framework.utils.AsyncTask;

public class StatusPluginTips extends StatusBarPlugin {
    public static StatusPluginTips instance = new StatusPluginTips();
    private StatusPluginTipsView view = null;

    public StatusPluginTips() {
        super("statusplugin.tips");
        // TODO Auto-generated constructor stub
    }

    @Override
    protected void onCreate() {
        // TODO Auto-generated method stub
        super.onCreate();
    }

    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        view = null;
    }

    @Override
    public StatusBarPluginView inflate(String pattern) {
        // TODO Auto-generated method stub
        if (view == null)
            view = new StatusPluginTipsView(mContext, getName());
        return view;
    }

    @Override
    public void show() {
        AsyncTask.runOnUiThread(new Runnable() {

            @Override
            public void run() {
                try {
                    view.show();
                } catch (Exception e) {
                }
            }
        });
    }

    @Override
    public void hide() {
        AsyncTask.runOnUiThread(new Runnable() {

            @Override
            public void run() {
                try {
                    view.hide();
                } catch (Exception e) {
                }
            }
        });
    }

}
